#ifndef REMOTECONTROLWIDGET_H
#define REMOTECONTROLWIDGET_H

#include <QWidget>
#include "dialogbase.h"
#include <QByteArray>
#include "mainwindow.h"
#include <QPainter>
#include <QPaintEvent>

class MainWindow;
namespace Ui {
class RemoteControlWidget;
}

class RemoteControlWidget : public DialogBase
{
    Q_OBJECT

public:
    explicit RemoteControlWidget(MainWindow* w,QWidget *parent = nullptr);
    ~RemoteControlWidget();

    enum DI1
    {
        CUR_PROTECT,        //保护电流门限值
        PROTECT_TIME,       //保护电流延时时间
        DI1_NUM
    };

    enum DI2
    {
        RlyOff,             //跳闸
        AllowOn,            //合闸允许
        RelayOn,            //直接合闸
        ALARM,              //报警
        ALL_CLEAR,          //报警解除
        POWER_PROTECT,      //保电
        POWER_PROTECT_OFF,  //保电解除
        DI2_NUM
    };
                                     //DI0 DI1 DI2 DI3
    QByteArray Oad1[DI1_NUM]={QByteArray::fromHex("02140004"),QByteArray::fromHex("03140004")};
    QByteArray Oad2[DI2_NUM]={QByteArray::fromHex("1A00"),QByteArray::fromHex("1B00"),QByteArray::fromHex("1C00"),
                              QByteArray::fromHex("2A00"),QByteArray::fromHex("2B00"),QByteArray::fromHex("3A00"),QByteArray::fromHex("3B00")};
    QByteArray Oad_prg=QByteArray::fromHex("0004CC04");
signals:
    void RemoteControlWidgetClosed();

    void setWindowTittle(QString tittle);

    void inputCheck(QString s);

protected:

private slots:
    void on_btn_read_clicked();

    void on_btn_write_clicked();

    void on_btn_set_clicked();

    void ParseData(QByteArray arr);


    void on_btn_setprg_clicked();

private:
    Ui::RemoteControlWidget *ui;
    QList<QByteArray>m_commands;
    MainWindow* m_mainWindow;
};

#endif // REMOTECONTROLWIDGET_H
